package com.dziennik.wedkarza;

import com.dziennik.wedkarza.database.DatabaseAdapter;

import android.os.Bundle;
import android.widget.ListView;
import android.app.Activity;
import android.database.Cursor;
import android.widget.SimpleCursorAdapter;



//klasa ListaIdentyfikatorowLowiskaActivity, która umożliwia wyświetlanie listy rekordów danych z bazy SQLite.

public class ListaIdentyfikatorowLowiskaActivity extends Activity {
	
    private DatabaseAdapter DatabaseAdapter; 
    private ListView listview;
    
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
		
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lista_identyfikatorow_lowiska_activity);
        listview = (ListView) findViewById(R.id.listView);
        
        DatabaseAdapter = new DatabaseAdapter(this);
        DatabaseAdapter.open();
        
        Cursor cursor = DatabaseAdapter.getAllEntries();
        startManagingCursor(cursor);
        String[] from = new String[]{DatabaseAdapter.KEY_CODE_FISHERIES};
        int[] to = new int[]{R.id.textViewFisheriesCode};
        
        SimpleCursorAdapter cursorAdapter =
        	       new SimpleCursorAdapter(this, R.layout.row_layout, cursor, from, to);
                   listview.setAdapter(cursorAdapter);
        
        DatabaseAdapter.close();        
   }	
}

	

	
